import { createRouter, createWebHistory } from "vue-router";
import { routes } from "vue-router/auto-routes";
const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/",
      redirect: "/lead",
    },
    ...routes,
  ],
});
router.beforeEach((to, from, next) => {
  console.log(to, from);
  if (to.meta.microApp) {
    // 确保传递正确的子应用路径
    const subAppPath = to.path.replace("/sub-app", "") || "/";
    to.query.subAppPath = encodeURIComponent(subAppPath);
  }
  next();
});
export default router;
